import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import eslint from 'vite-plugin-eslint';
import checker from 'vite-plugin-checker';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
      '@assets': resolve(__dirname, './src/assets'),
    },
  },
  envPrefix: 'VITE_', // 环境变量前缀配置
  css: {
    preprocessorOptions: {
      less: {
        math: 'always',
        globalVars: {
          // 全局变量可以在这里配置
        },
      },
    },
    devSourcemap: true, // 开启css的sourceMap
  },
  plugins: [
    react(),
    eslint({
      failOnError: false,
    }),
    checker({
      typescript: true,
    }),
  ],
});
